#ifndef __CH32V_DEF_BUILD_H__
#define __CH32V_DEF_BUILD_H__

#if !defined(CMSIS_STARTUP_FILE) && !defined(CUSTOM_STARTUP_FILE)
    #ifdef CH32V0xx
        #define CMSIS_STARTUP_FILE "startup_ch32v00x.S"
    #elif defined(CH32V1xx) 
        #ifdef __FREERTOS__
            #define CMSIS_STARTUP_FILE "startup_ch32v10x_freertos.S"
        #else
            #define CMSIS_STARTUP_FILE "startup_ch32v10x.S"
        #endif
    #elif defined(CH32V3xx)
        #ifdef __FREERTOS__
            #if !defined(CH32V30x_D8)
                #define CMSIS_STARTUP_FILE "startup_ch32v30x_D8C_freertos.S"
            #else
                #define CMSIS_STARTUP_FILE "startup_ch32v30x_D8_freertos.S"
            #endif
        #else
            #if !defined(CH32V30x_D8)
                #define CMSIS_STARTUP_FILE "startup_ch32v30x_D8C.S"
            #else
                #define CMSIS_STARTUP_FILE "startup_ch32v30x_D8.S"
            #endif
        #endif
    #else
        #error UNKNOWN CHIP
    #endif
#else
    #warning "No CMSIS startup file defined, custom one should be used"
#endif

#endif // __CH32V_DEF_BUILD_H__